New Transparent GIF Output from Visual Thought


Introduction

Visual Thought 1.2 can export GIF89 images with transparent backgrounds. This feature is especially useful if you need to export images for Web site development. The left image below is standard GIF87 without transparency, and the right image is GIF89 with a transparent background, created using the techniques described in this document. Both images were exported directly from Visual Thought.



How to Export Transparent GIF Files from Visual Thought

Here is how to create transparent GIF images using Visual Thought on UNIX:

  1. Pick a named color known to the X server that you will not be using in your images. This color will serve as the temporary background color and will be converted to transparent during the export.

    You can find a suitable color by opening the VT color chooser (e.g., by selecting an object and pressing the Fill Set Color... button in the Inspector Style panel) and choosing the Views->Named Colors menu item.

    We recommend bisque because you're not likely to use it elsewhere, and it appears near the top of the list of named colors. The rest of this discussion will use this color.

    Important: The named color you choose should not be dithered (shown as a combination of 2 or more other colors) when displayed. An image exported with that color will not be made transparent. If your chosen color is dithered, you should set up 2 or more export choices to help ensure that at least one will work. See below for more information.

  2. Add the following lines to the file ~/.vthought/Translators
      format tgif gif Transparent GIF (gif) [bisque]
      translator tiff tgif convert_cf tiff:$INFILE -trans bisque -cr 0x0 gif:$OUTFILE
    
    This will add the new export option "Transparent GIF (gif) [bisque]" to the File Type menu of the Export file chooser. VT must be restarted for the new entry to become effective.

    You can also make these changes available system-wide. Simply add the lines to the system Translator files instead of the user Translator file. The system Translator files are at:

      /usr/local/confluent/vt-1.2/solaris-2/config/Translators
      /usr/local/confluent/vt-1.2/sunos-4.1/config/Translators
      /usr/local/confluent/vt-1.2/hpux-9/config/Translators
    
    assuming that you installed Visual Thought in /usr/local/confluent. If not, adjust the path accordingly.

  3. For each image you create and wish to export with a transparent background, place a rectangular object under the image with a size that extends beyond the bounds of the image. For this object, turn off stroke and shadow (leave fill on) and set the fill color to bisque.

    The exported image will have the size of this object and will be transparent where this object is visible.

  4. Export the image using the new "Transparent GIF (gif) [bisque]" File Type.


In Case Your Chosen Color is Dithered

If a symbol filled with bisque (or your chosen color) is dithered (i.e., the symbol looks like it's filled with 2 or more colors whose average looks like bisque), it means Visual Thought couldn't allocate a solid color for bisque and had to approximate.

The problem is that dithered colors can't be made transparent. You need to use another color. One thing to try is to create multiple Translator file entries, with the expectation that at least one of them will not be dithered. For example, you could try creating entries with the primary or secondary colors (which have a better chance of not being dithered):

  format tgif_c gif Transparent GIF (gif) [cyan]
  format tgif_m gif Transparent GIF (gif) [magenta]
  format tgif_y gif Transparent GIF (gif) [yellow]
  translator tiff tgif_c convert_cf tiff:$INFILE -trans cyan -cr 0x0 gif:$OUTFILE
  translator tiff tgif_m convert_cf tiff:$INFILE -trans magenta -cr 0x0 gif:$OUTFILE
  translator tiff tgif_y convert_cf tiff:$INFILE -trans yellow -cr 0x0 gif:$OUTFILE
Doing this also improves the chances that an image you are creating won't use all the colors that are candidates for transparency.


© 1996, 1997 Confluent, Inc. All rights reserved.


Confluent, Inc. * 400 Spear Street, Suite 207 * San Francisco, CA 94105
800-780-2838 and 415-764-1000 tel * 415-764-1008 fax * info@confluent.com

Please send comments about this web site to:

webmaster@confluent.com